<template>
	<view class="wanl-money">
		<view class="top">
			<view class="title">
				<image src="https://fen.fuliaoxx.com/img/new/goods/j.png" class="title__icon" mode=""></image>
				{{$getText('我的余额')}}
			</view>

			<view class="wanl-money__num">
				{{info.money || "0.00"}}
			</view>
		</view>
		<!-- 功能 -->
		<!-- <view class="cu-list menu sm-border">
			
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/money/withdraw')">
				<view class="content">
					<text class="wlIcon-tixianjilu text-orange"></text>
					<text>提现</text>
				</view>
				<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/bank/bank')">
					<view class="content">
						<text class="wlIcon-yinhangka text-blue"></text>
						<text>银行卡</text>
					</view>
					<view class="action">
						<text class="text-sm wanl-gray">用于提现到第三方账户</text>
					</view>
				</view>
				<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/money/list')">
					<view class="content">
						<text class="wlIcon-yue1 text-orange"></text>
						<text>账单明细</text>
					</view>
				</view>
				<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/money/witlist')">
					<view class="content">
						<text class="wlIcon-jinbitixian text-orange"></text>
						<text>提现日志</text>
					</view>
				</view>
			</view>
		</view> -->
		<view class="box">
			<view class="box__item" v-for="(item,index) in list" :key="index" @tap="nav(item.url)">
				<view class="box__item__iconbox">
					<image :src="'https://fen.fuliaoxx.com/img/new/money/'+item.icon+'.png'" :style="item.st" mode="">
					</image>
				</view>
				<view class="box__item__r">
					<view class="box__item__label">
						{{$getText(item.name) }}
					</view>
					<view class="box__item__val">
						{{$getText(item.val) }}
					</view>
					<image src="https://fen.fuliaoxx.com/img/new/money/more.png" class="box__item__more" mode="">
					</image>
				</view>
			</view>
			<!-- <view v-if="language==1" class="box__item" v-for="(item,index) in list2" :key="index" @tap="$wanlshop.to(item.url)">
				<view class="box__item__iconbox">
					<image :src="'https://fen.fuliaoxx.com/img/new/money/'+item.icon+'.png'" :style="item.st" mode=""></image>
				</view>
				<view class="box__item__r">
					<view class="box__item__label">
						{{item.name}}
					</view>
					<view class="box__item__val">
						{{item.val}}
					</view>
					<image src="https://fen.fuliaoxx.com/img/new/money/more.png" class="box__item__more" mode=""></image>
				</view>
			</view> -->
		</view>
		<home></home>

	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import home from '@/components/home/index'
	export default {
		components: {
			home
		},
		data() {
			return {
				info: {},
				show: false,
				list: [
					// {name:'账户',val:'用于提现到第三方账户',url:'/pages/user/bank/bank',st:'width: 35.5rpx;height: 28.5rpx;',icon:'bank'},
					{
						name: '提现',
						val: '',
						url: '/pagesA/money/withdraw',
						st: 'width: 35.5rpx;height: 30rpx;',
						icon: 'tx'
					},
					{
						name: '账单明细',
						val: '',
						url: '/pagesA/money/list',
						st: 'width: 33rpx;height: 36rpx;',
						icon: 'zd'
					},
					{
						name: '提现日志',
						val: '',
						url: '/pagesA/money/witlist',
						st: 'width: 35rpx;height: 34.5rpx;',
						icon: 'rz'
					},
				],
				list2: [
					// {name:'账户',val:'用于提现到第三方账户',url:'/pages/user/bank/bank',st:'width: 35.5rpx;height: 28.5rpx;',icon:'bank'},
					{
						name: '提现',
						val: '',
						url: '/pagesA/money/withdraw',
						st: 'width: 35.5rpx;height: 30rpx;',
						icon: 'tx'
					},
					{
						name: '账单明细',
						val: '',
						url: '/pagesA/money/list',
						st: 'width: 33rpx;height: 36rpx;',
						icon: 'zd'
					},
					{
						name: '提现日志',
						val: '',
						url: '/pagesA/money/witlist',
						st: 'width: 35rpx;height: 34.5rpx;',
						icon: 'rz'
					},
				]
			};
		},
		computed: {
			...mapState(['user']),
			...mapState('translate', ['language']),
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title: this.$getText('我的钱包')
			})
			uni.login({
				provider: 'weixin',
				success: res => {
					this.loginRes = res;
				},
				fail: err => {
					this.$wanlshop.msg(err.msg);
				}
			});
			this.loadData();
		},
		methods: {
			async decryptPhoneNumber(e) {
				if (e.detail.errMsg != "getPhoneNumber:fail user deny") {
					await uni.request({
						url: '/wanlshop/user/boundOpenid',
						method: 'POST',
						data: {
							encryptedData: e.detail.encryptedData,
							iv: e.detail.iv,
							code: this.loginRes.code,
							client_id: uni.getStorageSync("wanlshop:chat_client_id") ? uni.getStorageSync(
								"wanlshop:chat_client_id") : null
						},
						success: res => {
							console.log(res)

						}
					});
				}
			},
			async nav(url) {
				await uni.request({
					url: '/wanlshop/pay/isOpenid',
					method: "GET",
					header: {
						isAdmin: true,
						token: uni.getStorageSync("shop_login_token")
					},
					success: res => {
						console.log(res)
						if (res.data == 0) {
							// #ifdef APP-PLUS
							
							uni.navigateTo({
								url: '/pages/user/auth/auth1'
							})
							// #endif
							
							// #ifdef H5
							
							uni.navigateTo({
								url: '/pages/user/auth/auth1'
							})
							
							// #endif
							
							// #ifdef MP-WEIXIN
							
							uni.navigateTo({
								url: '/pages/user/auth/auth'
							})
							
							// #endif
						} else {
							uni.navigateTo({
								url
							})
						}
					}
				});


			},
			async loadData() {

				await uni.request({
					url: '/index/shopInfo',
					method: "GET",
					header: {
						isAdmin: true,
						token: uni.getStorageSync("shop_login_token")
					},
					success: res => {
						this.info = res.data.shopInfo;

					}
				});
			}
		}
	};
</script>

<style lang="scss">
	.wanl-money .title {
		font-family: PingFang-SC, PingFang-SC;
		font-weight: bold;
		font-size: 30rpx;
		color: #000000;
		line-height: 30rpx;
		display: flex;
		align-items: center;
		padding-top: 32rpx;

		&__icon {
			width: 31rpx;
			height: 31rpx;
			margin: 0 11rpx 0 28rpx;

		}
	}

	.wanl-money {
		padding: 30rpx;

		&__num {
			font-family: DINNextLTPro, DINNextLTPro;
			font-weight: bold;
			font-size: 53rpx;
			color: #000000;
			line-height: 38rpx;
			padding: 36rpx 0 0 28rpx;
		}
	}

	.top {
		height: 171rpx;
		background: #f3f0eb;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
	}

	.box {
		margin-top: 30rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding-right: 28rpx;
		padding-top: 4rpx;

		&__item {
			display: flex;
			align-items: center;
			height: 106rpx;
			padding-right: 4rpx;

			&__iconbox {
				width: 88rpx;
				height: 106rpx;
				display: flex;
				align-items: center;
				justify-content: center;
			}

			&__r {
				flex: 1;
				height: 106rpx;
				border-bottom: 1rpx solid #F7F7FA;
				display: flex;
				align-items: center;

			}

			&__label {
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #333333;
				line-height: 30rpx;
			}

			&__val {
				flex: 1;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #999999;
				line-height: 24rpx;
				text-align: right;
				font-style: normal;
				text-transform: none;
			}

			&__more {
				width: 14rpx;
				height: 23rpx;
				margin-left: 14rpx;
			}
		}
	}
</style>